﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:helpers="clr-namespace:UCOLOR.Helpers">

    <Style TargetType="helpers:RenderScrollViewer">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="#FF515151" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="helpers:RenderScrollViewer">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Border helpers:SimpleManipulationHelper.OverrideManipulation="True" Background="#FF333333" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,0,0" Grid.Column="1" Grid.Row="1"
                                Visibility="{Binding Path=ComputedBothScrollBarsVisiblity, ElementName=ScrollContentControl, Mode=OneWay}" />
                            <helpers:RenderScrollContentControl x:Name="ScrollContentControl" Margin="{TemplateBinding Padding}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Content="{TemplateBinding Content}"
                                HorizontalScrollBarVisibility="{Binding Path=(ScrollViewer.HorizontalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"/>
                            <ScrollBar helpers:SimpleManipulationHelper.OverrideManipulation="True" Grid.Row="1" Orientation="Horizontal"
                                Visibility="{Binding Path=ComputedHorizontalScrollBarVisibility, ElementName=ScrollContentControl, Mode=OneWay}"
                                IsEnabled="{Binding Path=ComputedHorizontalScrollBarIsEnabled, ElementName=ScrollContentControl, Mode=OneWay}"
                                Minimum="{Binding Path=HorizontalMinimum, ElementName=ScrollContentControl, Mode=OneWay}"
                                Maximum="{Binding Path=HorizontalMaximum, ElementName=ScrollContentControl, Mode=OneWay}"
                                ViewportSize="{Binding Path=HorizontalViewportSize, ElementName=ScrollContentControl, Mode=OneWay}"
                                Value="{Binding Path=HorizontalValue, ElementName=ScrollContentControl, Mode=TwoWay}" />
                            <ScrollBar helpers:SimpleManipulationHelper.OverrideManipulation="True" Grid.Column="1" Orientation="Vertical"
                                Visibility="{Binding Path=ComputedVerticalScrollBarVisibility, ElementName=ScrollContentControl, Mode=OneWay}"
                                IsEnabled="{Binding Path=ComputedVerticalScrollBarIsEnabled, ElementName=ScrollContentControl, Mode=OneWay}"
                                Minimum="{Binding Path=VerticalMinimum, ElementName=ScrollContentControl, Mode=OneWay}"
                                Maximum="{Binding Path=VerticalMaximum, ElementName=ScrollContentControl, Mode=OneWay}"
                                ViewportSize="{Binding Path=VerticalViewportSize, ElementName=ScrollContentControl, Mode=OneWay}"
                                Value="{Binding Path=VerticalValue, ElementName=ScrollContentControl, Mode=TwoWay}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
